<#assign pojo=oneToManyPojo.getOne()>
<#assign many=oneToManyPojo.getMany()>
<#assign ones=oneToManyPojo.getOnes()>
package ${pojo.getPackageName()}.dao;

<#assign classbody>
<#assign declarationName = pojo.importType(pojo.getDeclarationName())>
/**
 * @author bo.wang
 */
@Component(${declarationName}Dao.BEAN_ID)
public class ${declarationName}Dao extends Base${declarationName}Dao{
	protected void build${declarationName}Query(Query query,Map values,Map params) {
		Object value=params.get("status");
		if(AssertHelper.notEmpty(value))
		{
			query.addCriteria(Criteria.where("status").is(value));
		}
		if(AssertHelper.notEmpty(TableColnumDef.FILTER_NAME_PATTERN))
		{
//            query.addCriteria(Criteria.where("status").is(value));
		}
	}
<#assign parentid = pojo.getDeclarationNameFirstLetterLower()+"Id">
<#foreach child in many>
<#assign childdeclarationName = child.importType(child.getDeclarationName())>
	protected void build${childdeclarationName}Query(Query query,Map values,Map params) {
		Object value=params.get("${parentid}");
		if(AssertHelper.notEmpty(value))
		{
			query.addCriteria(Criteria.where("${parentid}").is(value));
		}
		value=params.get("status");
		if(AssertHelper.notEmpty(value))
		{
			query.addCriteria(Criteria.where("status").is(value));
		}
		if(AssertHelper.notEmpty(TableColnumDef.FILTER_NAME_PATTERN))
		{
//			query.addCriteria(Criteria.where("status").is(value));
		}
	}
</#foreach>
<#foreach child in ones>
<#assign childdeclarationName = child.importType(child.getDeclarationName())>	
	protected void build${childdeclarationName}Query(Query query,Map values,Map params) {
		Object value=params.get("${parentid}");
		AssertHelper.notEmpty_assert("${childdeclarationName}关联主键不能为空");
		if(AssertHelper.notEmpty(value))
		{
			query.addCriteria(Criteria.where("${parentid}").is(value));
		}
	}
</#foreach>
}
</#assign>
import java.util.HashMap;
import java.util.List;
import java.util.Map;


import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component;

import com.ling.pl.core.dao.impl.BaseMongoDBDao;
import com.ling.pl.core.commons.utils.AssertHelper;
import com.ling.pl.core.commons.constant.TableColnumDef;

import ${pojo.getModelPackageName()}.${declarationName};
import ${pojo.getPackageName()}.dao.${declarationName}Dao;
<#foreach child in ones>
<#assign childdeclarationName = child.importType(child.getDeclarationName())>	
import ${child.getPackageName()}.model.${childdeclarationName};
</#foreach>
<#foreach child in many>
<#assign childdeclarationName = child.importType(child.getDeclarationName())>	
import ${child.getPackageName()}.model.${childdeclarationName};
</#foreach>
${classbody}
